import type { PageParam, PageResult } from '@vben/request';

import { requestClient } from '#/api/request';

export namespace VenueInfoApi {
  /** 阵地信息 */
  export interface VenueInfo {
    id?: number;
    // TODO: 添加字段
  }

  /** 阵地信息分页查询参数 */
  export interface VenueInfoPageReqVO extends PageParam {
    createTime?: string[];
    // TODO: 添加查询条件字段
  }
}

/** 查询阵地信息分页 */
export function getVenueInfoPage(params: VenueInfoApi.VenueInfoPageReqVO) {
  return requestClient.get<PageResult<VenueInfoApi.VenueInfo>>(
    '/cmt/venue-info/page',
    { params },
  );
}

/** 查询阵地信息详情 */
export function getVenueInfo(id: number) {
  return requestClient.get<VenueInfoApi.VenueInfo>(
    `/cmt/venue-info/get?id=${id}`,
  );
}

/** 新增阵地信息 */
export function createVenueInfo(data: VenueInfoApi.VenueInfo) {
  return requestClient.post('/cmt/venue-info/create', data);
}

/** 修改阵地信息 */
export function updateVenueInfo(data: VenueInfoApi.VenueInfo) {
  return requestClient.put('/cmt/venue-info/update', data);
}

/** 删除阵地信息 */
export function deleteVenueInfo(id: number) {
  return requestClient.delete(`/cmt/venue-info/delete?id=${id}`);
}

/** 批量删除阵地信息 */
export function deleteVenueInfoList(ids: number[]) {
  return requestClient.delete(
    `/cmt/venue-info/delete-list?ids=${ids.join(',')}`,
  );
}

/** 导出阵地信息 */
export function exportVenueInfo(params: any) {
  return requestClient.download('/cmt/venue-info/export-excel', { params });
}

/** 获取阵地选项列表(用于下拉选择) */
export function getVenueInfoOptions() {
  return requestClient.get<PageResult<VenueInfoApi.VenueInfo>>(
    '/cmt/venue-info/page',
    { params: { pageNo: -1, pageSize: 10 } },
  );
}
